import java.io.File;
import java.util.HashMap;

public class Bdd
{

	public static HashMap<String, FileData> SEED_MAP;
	public static HashMap<String, FileData> LEECH_LIST;
	public static HashMap<String, FileData> ON_TRACKER;
	public static HashMap<String, Peer> PEER_FOR_FILE;
	
	public static void init()
	{
		// Liste le répertoire seed
		SEED_MAP = new HashMap<String, FileData>();
		File repertoire = new File(Config.DIR_SEED);
                if (! repertoire.exists()) {
                    repertoire = new File("client\\" + Config.DIR_SEED);
                }
		String[] children = repertoire.list(); 
		
		for(int i=0; i<children.length; i++)
		{
			String nameF = children[i];
			
			if(!nameF.equals(".svn"))
			{
				String hash = Tools.MD5(nameF);
				FileData fd = new FileData(nameF, (new File(Config.DIR_SEED+"/"+nameF)).length(), Config.SIZE_PIECES, hash);
				fd.fillBufferMap();
				SEED_MAP.put(hash, fd);
			}
		}

		
		
		// Liste le répertoire leech
		LEECH_LIST = new HashMap<String, FileData>();
		
		
		// Liste des fichier dispo sur le tracker (après des look)
		ON_TRACKER = new HashMap<String, FileData>();
		
		
		// A une clé correspond la liste des peer
		PEER_FOR_FILE = new  HashMap<String, Peer>();
		
	}

}
